package com.example.springbootusecase.crossOrigin;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.OSSException;
import com.aliyun.oss.model.OSSObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;


/**
 * @author Think
 * 跨域问题处理demo
 */
@Slf4j
@RestController
@RequestMapping("/crossOrigin")
public class CrossOriginController {
    // 允许所有来源访问该接口
    //通过src/main/resources/html/crossOrigin.html文件夹内，右键启动bash.exe之后，
    //运行python -m http.server 8000通过Python的SimpleHTTPServer运行页面
    //然后通过http://localhost:8000/crossOrigin.html访问页面
    @CrossOrigin(origins = "*") // 可以指定具体的域名，如 "http://localhost:3000"
    @GetMapping("/hello")
    public String hello() {
        return "Hello, world!";
    }
}